//
//  MyCustonView.m
//  project_delicious
//
//  Created by dlios on 15-3-25.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "MyCustonView.h"

@implementation MyCustonView
- (instancetype)initWithFrame:(CGRect)frame
{
    

    self = [super initWithFrame:frame];
    if (self) {
        self.myImageView = [[UIImageView alloc] init];
        [self addSubview:self.myImageView];
        [_myImageView release];
        self.label = [[UILabel alloc] init];
        [self addSubview:self.label];
        [_label release];
        
        
        self.myPicImageView1 = [[UIImageView alloc] init];
        [self addSubview:self.myPicImageView1];
        [_myPicImageView1 release];
        self.picLabel1 = [[UILabel alloc] init];
        self.picLabel1.font = [UIFont systemFontOfSize:10];
        [self addSubview:self.picLabel1];
        [_picLabel1 release];
        
        self.myPicImageView2 = [[UIImageView alloc] init];
        [self addSubview:self.myPicImageView2];
        [_myPicImageView2 release];
        self.picLabel2 = [[UILabel alloc] init];
        self.picLabel2.font = [UIFont systemFontOfSize:10];
        [self addSubview:self.picLabel2];
        [_picLabel2 release];
        
        self.myPicImageView3 = [[UIImageView alloc] init];
        [self addSubview:self.myPicImageView3];
        [_myPicImageView3 release];
        self.picLabel3 = [[UILabel alloc] init];
        self.picLabel3.font = [UIFont systemFontOfSize:10];
        [self addSubview:self.picLabel3];
        [_picLabel3 release];
        
        
        self.userInteractionEnabled = YES;
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    CGFloat widths = self.frame.size.width;
    CGFloat heights = self.frame.size.height;
    self.myImageView.frame = CGRectMake(0, 0, widths / 8, heights * 3 / 10 - 10);
    self.label.frame = CGRectMake(widths / 8 + 10, 0, widths / 2, heights * 3 / 10 - 10);
    self.myPicImageView1.frame = CGRectMake(0, heights * 3 / 10, (widths - 20) / 3, (heights * 3 /5));
    self.picLabel1.frame =CGRectMake(20, heights * 9 / 10, (widths - 20) / 3 - 20, heights / 10);
   
    self.myPicImageView2.frame = CGRectMake(0 + (widths - 20) / 3 + 10, heights * 3 / 10, (widths - 20) / 3, (heights * 3 /5));
    self.picLabel2.frame = CGRectMake(20 + (widths - 20) / 3, heights * 9 / 10, (widths - 20) / 3 - 20, heights / 10);
    
    self.myPicImageView3.frame = CGRectMake(0 + (widths - 20) / 3 * 2 + 20, heights * 3 / 10, (widths - 20) / 3, (heights * 3 /5));
    self.picLabel3.frame = CGRectMake(20 + (widths - 20) / 3 * 2, heights * 9 / 10, (widths - 20) / 3 - 20, heights / 10);
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
